protected function setUp() {
parent::setUp();
- $this->filePath = __DIR__ . '/../../data/media';
+ $this->filePath = __DIR__ . '/../../data/media';
$this->backend = new FSFileBackend( array(
- 'name' => 'localtesting',
- 'lockManager' => 'nullLockManager',
+ 'name' => 'localtesting',
+ 'lockManager' => 'nullLockManager',
'containerPaths' => array( 'data' => $this->filePath )
) );
$this->repo = new FSRepo( array(
- 'name' => 'temp',
- 'url' => 'http://localhost/thumbtest',
+ 'name' => 'temp',
+ 'url' => 'http://localhost/thumbtest',
'backend' => $this->backend
) );
$this->handler = new GIFHandler();
$actual = $this->handler->isAnimatedImage( $file );
$this->assertEquals( $expected, $actual );
}
+
public static function provideIsAnimated() {
return array(
array( 'animated.gif', true ),
$actual = $this->handler->getImageArea( $file, $file->getWidth(), $file->getHeight() );
$this->assertEquals( $expected, $actual );
}
+
public static function provideGetImageArea() {
return array(
array( 'animated.gif', 5400 ),
$actual = $this->handler->isMetadataValid( null, $metadata );
$this->assertEquals( $expected, $actual );
}
+
public static function provideIsMetadataValid() {
return array(
array( GIFHandler::BROKEN_FILE, GIFHandler::METADATA_GOOD ),
);
}
+ /**
+ * @param $filename String
+ * @param $expected String Serialized array
+ * @dataProvider provideGetIndependentMetaArray
+ * @covers GIFHandler::getCommonMetaArray
+ */
+ public function testGetIndependentMetaArray( $filename, $expected ) {
+ $file = $this->dataFile( $filename, 'image/gif' );
+ $actual = $this->handler->getCommonMetaArray( $file );
+ $this->assertEquals( $expected, $actual );
+ }
+
+ public function provideGetIndependentMetaArray() {
+ return array(
+ array( 'nonanimated.gif', array(
+ 'GIFFileComment' => array(
+ 'GIF test file ⁕ Created with GIMP',
+ ),
+ ) ),
+ array( 'animated-xmp.gif',
+ array(
+ 'Artist' => 'Bawolff',
+ 'ImageDescription' => array(
+ 'x-default' => 'A file to test GIF',
+ '_type' => 'lang',
+ ),
+ 'SublocationDest' => 'The interwebs',
+ 'GIFFileComment' =>
+ array(
+ 'GIƒ·test·file',
+ ),
+ )
+ ),
+ );
+ }
+
private function dataFile( $name, $type ) {
return new UnregisteredLocalFile( false, $this->repo,
"mwstore://localtesting/data/$name", $type );